package com.moyq5.mvc.maker.test.bean.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

/**
 * 商户业务配置信息
 * @author Moyq5
 * @date 2018年5月20日
 */
@Entity
@Table(name = "uc_merch_biz_ext")
@DynamicUpdate
public class MerchBizExt implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4299810219494154410L;
	/**
	 * 商户ID
	 */
	@Id
	@OneToOne
	@JoinColumn(name="merch_id")
	private Merch merch;
	
	/**
	 * 开放功能-服务地址（商户自主平台的）
	 */
	@Column(name = "server_path", length = 200)
	private String serverPath;
	
	/**
	 * 开放功能-RSA交易密钥，或者MD5密钥
	 */
	@Column(name = "private_key", length = 2000)
	private String privateKey;
	
	/**
	 * 开放功能-RSA交易公钥
	 */
	@Column(name = "public_key", length = 2000)
	private String publicKey;

	/**
	 * 线上积分与线下币比值，即多少个线上积分相当于1个线下投币
	 */
	@Column(name = "integral_ratio", nullable = false, precision = 8, scale = 0, columnDefinition = "int(8) default '1'")
	private Integer integralRatio;
	
	/**
	 * 管理IP白名单，多个用回车换行区分
	 */
	@Column(name = "admin_ip", length = 100)
	private String adminIp;
	
	/**
	 * 开放接口IP白名单，多个用回车换行区分
	 */
	@Column(name = "open_ip", length = 100)
	private String openIp;

	@PrePersist
	public void prePersist() {
		if (null == integralRatio) {
			integralRatio = 1;
		}
	}
	
	public Merch getMerch() {
		return merch;
	}

	public void setMerch(Merch merch) {
		this.merch = merch;
	}

	public String getServerPath() {
		return serverPath;
	}

	public void setServerPath(String serverPath) {
		this.serverPath = serverPath;
	}

	public String getPrivateKey() {
		return privateKey;
	}

	public void setPrivateKey(String privateKey) {
		this.privateKey = privateKey;
	}

	public String getPublicKey() {
		return publicKey;
	}

	public void setPublicKey(String publicKey) {
		this.publicKey = publicKey;
	}

	public Integer getIntegralRatio() {
		return integralRatio;
	}

	public void setIntegralRatio(Integer integralRatio) {
		this.integralRatio = integralRatio;
	}

	public String getAdminIp() {
		return adminIp;
	}

	public void setAdminIp(String adminIp) {
		this.adminIp = adminIp;
	}

	public String getOpenIp() {
		return openIp;
	}

	public void setOpenIp(String openIp) {
		this.openIp = openIp;
	}
}
